Page({
  data: {
   cateItems: [
    {
     cate_id: 1,
     cate_name: "茶杯贴纸",
     ishaveChild: true,
     children:
     [
      {
       child_id: 1,
       name: '贴纸1',
       price:2,
       image: '/icon/paster/paster1.png'
      },
      {
       child_id: 2,
       name: '贴纸2',
       price:2,
       image: '/icon/paster/paster2.png'
      },
      {
       child_id: 3,
       name: '贴纸3',
       price:4,
       image: '/icon/paster/paster3.png'
      },
      {
       child_id: 4,
       name: '贴纸4',
       price:6,
       image: '/icon/paster/paster4.png'
      },
      {
       child_id: 5,
       name: '贴纸5',
       price:10,
       image: '/icon/paster/paster5.png'
      },
     ]
    },
    {
     cate_id: 2,
     cate_name: "文字贴纸",
     ishaveChild: true,
     children:
     [
      {
       child_id: 1,
       name: '文字1',
       price:2,
       image: "/icon/words/words1.jpg"
      },
      {
       child_id: 2,
       name: '文字2',
       price:300,
       image: "/icon/words/words2.jpg"
      },
      {
       child_id: 3,
       name: '文字2',
       price:2,
       image: "/icon/words/words3.jpg"
      },
      {
       child_id: 4,
       name: '文字4',
       price:4,
       image: "/icon/words/words4.jpg"
      },
      {
       child_id: 5,
       name: '文字5',
       price:6,
       image: "/icon/words/words5.jpg"
      },
      {
       child_id: 6,
       name: '文字6',
       price:6,
       image: "/icon/words/words6.jpg"
      },
      {
       child_id: 7,
       name: '文字7',
       price:10,
       image: "/icon/words/words7.png"
      },
      {
        child_id: 8,
        name: '文字8',
        price:10,
        image: "/icon/words/words8.png"
      },
      {
        child_id: 9,
        name: '文字9',
        price:10,
        image: "/icon/words/words9.png"
      },
      {
        child_id: 10,
        name: '文字10',
        price:10,
        image: "/icon/words/words10.png"
      }
     ]
    },
    {
      cate_id: 3,
      cate_name: "茶杯",
      ishaveChild: true,
      children:
      [
       {
        child_id: 1,
        name: '茶杯1',
        price:2,
        image: "/icon/teaCup/teaCup1.jpg"
       },
       {
        child_id: 2,
        name: '茶杯2',
        price:300,
        image: "/icon/teaCup/teaCup2.jpg"
       },
       {
        child_id: 3,
        name: '茶杯2',
        price:2,
        image: "/icon/teaCup/teaCup3.jpg"
       },
       {
        child_id: 4,
        name: '茶杯4',
        price:4,
        image: "/icon/teaCup/teaCup4.jpg"
       },
       {
        child_id: 5,
        name: '茶杯5',
        price:6,
        image: "/icon/teaCup/teaCup5.jpg"
       },
       {
        child_id: 6,
        name: '茶杯6',
        price:6,
        image: "/icon/teaCup/teaCup6.jpg"
       },
       {
        child_id: 7,
        name: '茶杯7',
        price:10,
        image: "/icon/teaCup/teaCup7.jpg"
       },
       {
         child_id: 8,
         name: '茶杯8',
         price:10,
         image: "/icon/teaCup/teaCup8.jpg"
       },
       {
         child_id: 9,
         name: '茶杯9',
         price:10,
         image: "/icon/teaCup/teaCup9.jpg"
       },
       {
         child_id: 10,
         name: '文字10',
         price:10,
         image: "/icon/teaCup/teaCup10.jpg"
       }
      ]
     },
   ],
   curNav: 1,
   curIndex: 0
  },
  
  //事件处理函数 
  switchRightTab: function (e) {
   // 获取item项的id，和数组的下标值 
   let id = e.target.dataset.id,
    index = parseInt(e.target.dataset.index);
   // 把点击到的某一项，设为当前index 
   this.setData({
    curNav: id,
    curIndex: index
   })
  },
  change:function(e){
    let id = e.currentTarget.dataset.index
    wx.showModal({
     title: '提示',
     content: '您已兑换',
     success: function (res) {
       if (res.confirm) {//这里是点击了确定以后
         console.log('用户点击确定')
       } else {//这里是点击了取消以后
         console.log('用户点击取消')
       }
     }
   })
  }
  })
  
  